package com.zyk.scaffold.seata.stock.business.stock.controller;

import com.zyk.scaffold.core.domain.Result;
import com.zyk.scaffold.seata.stock.business.stock.pojo.request.StockRequest;
import com.zyk.scaffold.seata.stock.business.stock.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/stock")
public class StockController {

    @Autowired
    private StockService stockService;

    @PostMapping("/ok")
    public Result<Boolean> ok(@RequestBody StockRequest stockRequest){
        return Result.ok(stockService.ok(stockRequest));
    }

    @PostMapping("/error")
    public Result<Boolean> error(@RequestBody StockRequest stockRequest){
        return Result.ok(stockService.error(stockRequest));
    }

    @PostMapping("/none_seata_ok")
    public Result<Boolean> none_seata_ok(@RequestBody StockRequest stockRequest){
        return Result.ok(stockService.none_seata_ok(stockRequest));
    }

    @PostMapping("/none_seata_error")
    public Result<Boolean> none_seata_error(@RequestBody StockRequest stockRequest){
        return Result.ok(stockService.none_seata_error(stockRequest));
    }
}
